package com.yellowpage.tool;

import com.yellowpage.bigdata.action.NspOnofflogTaSumDayAction;
import com.yellowpage.bigdata.service.NspOnofflogTaSumDayService;
import com.yellowpage.bigdata.service.NspOnofflogTaSumDayServiceImpl;
import com.yellowpage.mail.service.MailSendService;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Sun on 12/7/2015.
 */
public class QuartzJob
{
    private  String yesterday;


    public QuartzJob()
    {
        Date now = new Date();

        //获取昨天的日期
        now = new Date(now.getTime() - 1 * 24 * 60 * 60 * 1000);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        yesterday = dateFormat.format(now);
    }

    public void nspOnofflogTaSumDayActionEmail() throws Exception
    {

        //NspOnofflogTaSumDayAction nspOnofflogTaSumDayAction = (NspOnofflogTaSumDayAction)MyApplicationContextUtil.getBean("mailSendService");
        NspOnofflogTaSumDayAction nspOnofflogTaSumDayAction = new NspOnofflogTaSumDayAction();
        nspOnofflogTaSumDayAction.setNspOnofflogTaSumDayService((NspOnofflogTaSumDayService)MyApplicationContextUtil.getBean("nspOnofflogTaSumDayService"));

        nspOnofflogTaSumDayAction.setQuery_logDate(yesterday);
        nspOnofflogTaSumDayAction.setQuery_logDate_end(yesterday);

        nspOnofflogTaSumDayAction.emailSend();

    }

    //给出日统计报表按日发短信的JOB
    public void nspOnofflogTaSumDayActionMessage() throws Exception
    {
//        String content = "睡到自然醒";
//        String newcontent = new String(content.getBytes("GBK"),"GBK");
//        Message.groupSendMessage(newcontent,1);

        NspOnofflogTaSumDayAction nspOnofflogTaSumDayAction = new NspOnofflogTaSumDayAction();
        nspOnofflogTaSumDayAction.setNspOnofflogTaSumDayService((NspOnofflogTaSumDayService) MyApplicationContextUtil.getBean("nspOnofflogTaSumDayService"));

        nspOnofflogTaSumDayAction.setQuery_logDate(yesterday);
        nspOnofflogTaSumDayAction.setQuery_logDate_end(yesterday);

        nspOnofflogTaSumDayAction.messageSend();

    }

    public static void main(String args[]) throws Exception
    {
        String content = "睡到自然醒";
        Message.groupSendMessage(content, 1);
    }
}
